<template>
  <div>
    <template v-for="(item,index) of list">
      <el-submenu v-if="item.children && item.children.length > 0 && item.meta.show" :key="item.id" :index="index+''">
        <template slot="title">
          <i :class="item.meta.icon" style="color: #fff" v-if="item.meta.icon"/>
          <span>{{ item.meta.title }}</span>
        </template>
        <menu-list :list="item.children" />   <!--递归调用-->
      </el-submenu>
      <el-menu-item v-else-if="item.meta.show" :key="item.id" :index="item.path">
        <template slot="title">
          <i v-if="item.meta.icon" :class="item.meta.icon" style="color: #fff"/>
          <span slot="title">{{ item.meta.title }}</span>
        </template>
      </el-menu-item>
    </template>
  </div>
</template>
<script>
export default {
  name: 'MenuList',
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
